<template>
	<view class="page page-total">
		<view class="part1">
			<view class="p1 font15 font-b">我的佣金</view>
			<view class="p2 flex-row-between">
				<view class="flex-row-center">
					<text class="font18 font-assist">{{info.kt}}</text>
					<text class="font12">纽扣币</text>
				</view>
				<view v-if="info.extract == 1" class="btn" @click="goNext('/pages/coin/detailed')">提现明细</view>
			</view>
		</view>
		<view class="hr7"></view>
		<view class="item flex-row-between" v-for="(item,index) in detailslist" :key="index">
			<view class="left font15">{{item.title}}</view>
			<view class="right">
				<text class="font15">{{item.money}}</text>
				<view class="font12">纽扣币</view>
			</view>
		</view>
		<view class="hr7"></view>
		<!-- 用户需知 -->
		<view class="needknow">
			<uni-collapse>
				<uni-collapse-item title="用户须知" showAnimation="true">
					<view class="tips">{{info.notice}}</view>
				</uni-collapse-item>
			</uni-collapse>
		</view>
		<!-- 按钮 -->
		<view v-if="info.extract == 1" class="fix-bottom-btn flex-row-center">
			<view class="btn flex-row-center font-ffffff font15" @click="goNext('/pages/coin/reflect')">我要提现</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
				detailslist: [
					{title: '可提现佣金',money: '0'},
					{title: '已提现佣金',money: '0'},
					{title: '待打款佣金',money: '0'},
				]
			}
		},
		onLoad() {
			this.$Http({
				url: 'coinTotal',
				token: true,
				load: true
			}).then(res => {
				if (res.code == 1) {
					this.info = res.data
					this.detailslist[0].money = res.data.kt
					this.detailslist[1].money = res.data.yt
					this.detailslist[2].money = res.data.dt
				}
			});
		},
		methods: {
			// 路由跳转: tag默认false,tag=true跳到tabBar页面
			goNext(url, tag, key) {
				if (tag) {
					uni.switchTab({ url: url });
				} else {
					uni.navigateTo({ url: url });
				}
			}
		}
	}
</script>

<style lang="less">
	@import url("style.less");
</style>
